<?php

namespace common\entities\picture;

use Yii;

/**
 * This is the model class for table "myscrm_ad_picture".
 *
 * @property string $id
 * @property integer $type
 * @property string $title
 * @property string $redirect_url
 * @property integer $is_able
 * @property integer $sort
 * @property string $picture
 * @property string $created_by
 * @property string $created_time
 * @property string $modified_by
 * @property string $modified_time
 * @property string $bg_color
 */
class PictureEntity extends \common\entities\ConfigEntity
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'myscrm_ad_picture';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('cdb');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['type', 'is_able', 'sort'], 'integer'],
            [['created_time', 'modified_time'], 'safe'],
            [['title', 'created_by', 'modified_by'], 'string', 'max' => 256],
            [['redirect_url', 'picture'], 'string', 'max' => 1000],
            [['bg_color'], 'string', 'max' => 36]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '主键',
            'type' => '图片类型 1 登录底图 2 广告位图片',
            'title' => '图片主题',
            'redirect_url' => '跳转地址',
            'is_able' => '是否启用 0 否 1是',
            'sort' => '排序',
            'picture' => '图片地址',
            'created_by' => '添加人',
            'created_time' => '添加时间',
            'modified_by' => 'Modified By',
            'modified_time' => 'Modified Time',
            'bg_color' => '底纹颜色'
        ];
    }
}
